#include<iostream>
using namespace std;
int main(){
	int n;
	while (cin >> n && n != 0){
		int dis[100];
		int oil[100];
		int i, count = 0;
		for (i = 1; count <= n; i++){
			count += 500/(2*i-1);
			dis[i] = n - count;
			oil[i] = 500*i;
		}
		for (int j = 2; j < i; j++){
			cout << j-1 << "  " << dis[i-j] << "  "
				 << oil[i-j] << endl;
		}
	}
	return 0; 
} 
